home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 February / EnigmA AMIGA RUN 34 (1999)(G.R. Edizioni)(IT)[!][issue 1999-02].iso / earcd / devel / libx11 / include / x11 / extensions / xtestext1.h < prev   
C/C++ Source or Header  |  1999-01-01  |  10KB  |  303 lines

  1. /*
  2.  * xtestext1.h
  3.  *
  4.  * X11 Input Synthesis Extension include file
  5.  */
  6.  
  7. /*
  8.  
  9. Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation
  10. Copyright 1986, 1987, 1988 by the Massachusetts Institute of Technology
  11.  
  12. Permission to use, copy, modify, and distribute this
  13. software and its documentation for any purpose and without
  14. fee is hereby granted, provided that the above copyright
  15. notice appear in all copies and that both that copyright
  16. notice and this permission notice appear in supporting
  17. documentation, and that the name of M.I.T. not be used in
  18. advertising or publicity pertaining to distribution of the
  19. software without specific, written prior permission.
  20.  
  21. Hewlett-Packard and M.I.T. make no representations about the 
  22. suitability of this software for any purpose.  It is provided 
  23. "as is" without express or implied warranty.
  24.  
  25. This software is not subject to any license of the American
  26. Telephone and Telegraph Company or of the Regents of the
  27. University of California.
  28.  
  29. */
  30.  
  31. /*
  32.  * the typedefs for CARD8, CARD16, and CARD32 are defined in Xmd.h
  33.  */
  34.  
  35. /*
  36.  * used in the XTestPressButton and XTestPressKey functions
  37.  */
  38. #define XTestPRESS                      1 << 0
  39. #define XTestRELEASE                    1 << 1
  40. #define XTestSTROKE                     1 << 2
  41.  
  42. /*
  43.  * When doing a key or button stroke, the number of milliseconds
  44.  * to delay between the press and the release of a key or button
  45.  * in the XTestPressButton and XTestPressKey functions.
  46.  */
  47.  
  48. #define XTestSTROKE_DELAY_TIME        10
  49.  
  50. /*
  51.  * used in the XTestGetInput function
  52.  */
  53. #define XTestEXCLUSIVE                  1 << 0
  54. #define XTestPACKED_ACTIONS             1 << 1
  55. #define XTestPACKED_MOTION              1 << 2
  56.  
  57. /*
  58.  * used in the XTestFakeInput function
  59.  */
  60. #define XTestFAKE_ACK_NOT_NEEDED        0
  61. #define XTestFAKE_ACK_REQUEST           1
  62.  
  63. /*
  64.  * used in the XTest extension initialization routine
  65.  */
  66. #define XTestEXTENSION_NAME             "XTestExtension1"
  67. #define XTestEVENT_COUNT                2
  68.  
  69. /*
  70.  * XTest request type values 
  71.  *
  72.  * used in the XTest extension protocol requests
  73.  */
  74. #define X_TestFakeInput                  1
  75. #define X_TestGetInput                   2
  76. #define X_TestStopInput                  3
  77. #define X_TestReset                      4
  78. #define X_TestQueryInputSize             5
  79.  
  80. /*
  81.  * This defines the maximum size of a list of input actions
  82.  * to be sent to the server.  It should always be a multiple of
  83.  * 4 so that the entire xTestFakeInputReq structure size is a
  84.  * multiple of 4.
  85.  */
  86. #define XTestMAX_ACTION_LIST_SIZE       64
  87.  
  88. typedef struct {
  89.         CARD8   reqType;        /* always XTestReqCode             */
  90.         CARD8   XTestReqType;   /* always X_TestFakeInput           */
  91.         CARD16  length B16;     /* 2 + XTestMAX_ACTION_LIST_SIZE/4 */
  92.         CARD32  ack B32;
  93.         CARD8   action_list[XTestMAX_ACTION_LIST_SIZE];
  94. } xTestFakeInputReq;
  95. #define sz_xTestFakeInputReq (XTestMAX_ACTION_LIST_SIZE + 8)
  96.  
  97. typedef struct {
  98.         CARD8   reqType;        /* always XTestReqCode  */
  99.         CARD8   XTestReqType;   /* always X_TestGetInput */
  100.         CARD16  length B16;     /* 2                    */
  101.         CARD32  mode B32;
  102. } xTestGetInputReq;
  103. #define sz_xTestGetInputReq 8
  104.  
  105. typedef struct {
  106.         CARD8   reqType;        /* always XTestReqCode   */
  107.         CARD8   XTestReqType;   /* always X_TestStopInput */
  108.         CARD16  length B32;     /* 1                     */
  109. } xTestStopInputReq;
  110. #define sz_xTestStopInputReq 4
  111.  
  112. typedef struct {
  113.         CARD8   reqType;        /* always XTestReqCode */
  114.         CARD8   XTestReqType;   /* always X_TestReset   */
  115.         CARD16  length B16;     /* 1                   */
  116. } xTestResetReq;
  117. #define sz_xTestResetReq 4
  118.  
  119. typedef struct {
  120.         CARD8   reqType;        /* always XTestReqCode        */
  121.         CARD8   XTestReqType;   /* always X_TestQueryInputSize */
  122.         CARD16  length B16;     /* 1                          */
  123. } xTestQueryInputSizeReq;
  124. #define sz_xTestQueryInputSizeReq 4
  125.  
  126. /*
  127.  * This is the definition of the reply for the xTestQueryInputSize
  128.  * request.  It should remain the same minimum size as other replies
  129.  * (32 bytes).
  130.  */
  131. typedef struct {
  132.         CARD8   type;           /* always X_Reply  */
  133.         CARD8   pad1;
  134.         CARD16  sequenceNumber B16;
  135.         CARD32  length B32;     /* always 0 */
  136.         CARD32  size_return B32;
  137.         CARD32  pad2 B32;
  138.         CARD32  pad3 B32;
  139.         CARD32  pad4 B32;
  140.         CARD32  pad5 B32;
  141.         CARD32  pad6 B32;
  142. } xTestQueryInputSizeReply;
  143.  
  144. /*
  145.  * This is the definition for the input action wire event structure.
  146.  * This event is sent to the client when the server has one or
  147.  * more user input actions to report to the client.  It must
  148.  * remain the same size as all other wire events (32 bytes).
  149.  */
  150. #define XTestACTIONS_SIZE    28
  151.  
  152. typedef struct {
  153.         CARD8   type;           /* always XTestInputActionType */
  154.         CARD8   pad00;
  155.         CARD16  sequenceNumber B16;
  156.         CARD8   actions[XTestACTIONS_SIZE];
  157. } xTestInputActionEvent;
  158.  
  159. /*
  160.  * This is the definition for the xTestFakeAck wire event structure.
  161.  * This event is sent to the client when the server has completely
  162.  * processed its input action buffer, and is ready for more.
  163.  * It must remain the same size as all other wire events (32 bytes).
  164.  */
  165. typedef struct {
  166.         CARD8   type;           /* always XTestFakeAckType */
  167.         CARD8   pad00;
  168.         CARD16  sequenceNumber B16;
  169.         CARD32  pad02 B32;
  170.         CARD32  pad03 B32;
  171.         CARD32  pad04 B32;
  172.         CARD32  pad05 B32;
  173.         CARD32  pad06 B32;
  174.         CARD32  pad07 B32;
  175.         CARD32  pad08 B32;
  176. } xTestFakeAckEvent;
  177.  
  178. /*
  179.  * The server side of this extension does not (and should not) have
  180.  * definitions for Display and Window.  The ifndef allows the server
  181.  * side of the extension to ignore the following typedefs.
  182.  */
  183. #ifndef XTestSERVER_SIDE
  184. /*
  185.  * This is the definition for the input action host format event structure.
  186.  * This is the form that a client using this extension will see when
  187.  * it receives an input action event.
  188.  */
  189. typedef struct {
  190.         int     type;           /* always XTestInputActionType */
  191.     Display *display;
  192.     Window  window;
  193.         CARD8   actions[XTestACTIONS_SIZE];
  194. } XTestInputActionEvent;
  195.  
  196. /*
  197.  * This is the definition for the xTestFakeAck host format event structure.
  198.  * This is the form that a client using this extension will see when
  199.  * it receives an XTestFakeAck event.
  200.  */
  201. typedef struct {
  202.         int     type;           /* always XTestFakeAckType */
  203.     Display *display;
  204.     Window  window;
  205. } XTestFakeAckEvent;
  206. #endif
  207.  
  208. /*
  209.  * This is the definition for the format of the header byte
  210.  * in the input action structures.
  211.  */
  212. #define XTestACTION_TYPE_MASK   0x03    /* bits 0 and 1          */
  213. #define XTestKEY_STATE_MASK     0x04    /* bit 2 (key action)    */
  214. #define XTestX_SIGN_BIT_MASK    0x04    /* bit 2 (motion action) */
  215. #define XTestY_SIGN_BIT_MASK    0x08    /* bit 3 (motion action) */
  216. #define XTestDEVICE_ID_MASK     0xf0    /* bits 4 through 7      */
  217.  
  218. #define XTestMAX_DEVICE_ID    0x0f
  219. #define XTestPackDeviceID(x)    (((x) & XTestMAX_DEVICE_ID) << 4)
  220. #define XTestUnpackDeviceID(x)    (((x) & XTestDEVICE_ID_MASK) >> 4)
  221.  
  222. /*
  223.  * These are the possible action types.
  224.  */
  225. #define XTestDELAY_ACTION       0
  226. #define XTestKEY_ACTION         1
  227. #define XTestMOTION_ACTION      2
  228. #define XTestJUMP_ACTION        3
  229.  
  230. /*
  231.  * These are the definitions for key/button motion input actions.
  232.  */
  233. #define XTestKEY_UP             0x04
  234. #define XTestKEY_DOWN           0x00
  235.  
  236. typedef struct {
  237.         CARD8   header;         /* which device, key up/down */
  238.         CARD8   keycode;        /* which key/button to move  */
  239.         CARD16  delay_time B16; /* how long to delay (in ms) */
  240. } XTestKeyInfo;
  241.  
  242. /*
  243.  * This is the definition for pointer jump input actions.
  244.  */
  245. typedef struct {
  246.         CARD8   header;         /* which pointer             */
  247.         CARD8   pad1;           /* unused padding byte       */
  248.         CARD16  jumpx B16;      /* x coord to jump to        */
  249.         CARD16  jumpy B16;      /* y coord to jump to        */
  250.         CARD16  delay_time B16; /* how long to delay (in ms) */
  251. } XTestJumpInfo;
  252.  
  253. /*
  254.  * These are the definitions for pointer relative motion input
  255.  * actions.
  256.  *
  257.  * The sign bits for the x and y relative motions are contained
  258.  * in the header byte.  The x and y relative motions are packed
  259.  * into one byte to make things fit in 32 bits.  If the relative
  260.  * motion range is larger than +/-15, use the pointer jump action.
  261.  */
  262. #define XTestMOTION_MAX            15
  263. #define XTestMOTION_MIN            -15
  264.  
  265. #define XTestX_NEGATIVE            0x04
  266. #define XTestY_NEGATIVE            0x08
  267.  
  268. #define XTestX_MOTION_MASK         0x0f
  269. #define XTestY_MOTION_MASK         0xf0
  270.  
  271. #define XTestPackXMotionValue(x)   ((x) & XTestX_MOTION_MASK)
  272. #define XTestPackYMotionValue(x)   (((x) << 4) & XTestY_MOTION_MASK)
  273.  
  274. #define XTestUnpackXMotionValue(x) ((x) & XTestX_MOTION_MASK)
  275. #define XTestUnpackYMotionValue(x) (((x) & XTestY_MOTION_MASK) >> 4)
  276.  
  277. typedef struct {
  278.         CARD8   header;         /* which pointer             */
  279.         CARD8   motion_data;    /* x,y relative motion       */
  280.         CARD16  delay_time B16; /* how long to delay (in ms) */
  281. } XTestMotionInfo;
  282.  
  283. /*
  284.  * These are the definitions for a long delay input action.  It is 
  285.  * used when more than XTestSHORT_DELAY_TIME milliseconds of delay
  286.  * (approximately one minute) is needed.
  287.  *
  288.  * The device ID for a delay is always set to XTestDELAY_DEVICE_ID.
  289.  * This guarantees that a header byte with a value of 0 is not
  290.  * a valid header, so it can be used as a flag to indicate that
  291.  * there are no more input actions in an XTestInputAction event.
  292.  */
  293.  
  294. #define XTestSHORT_DELAY_TIME    0xffff
  295. #define XTestDELAY_DEVICE_ID    0x0f   
  296.  
  297. typedef struct {
  298.         CARD8   header;         /* always XTestDELAY_DEVICE_ID */
  299.         CARD8   pad1;           /* unused padding byte         */
  300.         CARD16  pad2 B16;       /* unused padding word         */
  301.         CARD32  delay_time B32; /* how long to delay (in ms)   */
  302. } XTestDelayInfo;
  303.